package top.datacluster.basic.algorithm.leetcode.dynamic;

public class LeetCode1519 {

    public int numberOf2sInRange(int n) {
        int count = 0;
        for (int i = 2; i < n; i++){
            int temp = i;
            while (temp > 0){
                int k = temp % 10;
                if (k == 2){
                    count++;
                }
                temp = temp / 10;
            }
        }

        return count;
    }

    public static void main(String[] args) {
        System.out.println(new LeetCode1519().numberOf2sInRange(130));
    }
}
